
<h1>{{ form.title }}</h1>
<form action="{{ form.action | safe }}" method="POST">
{{? form.description}}
  <div class="desc-">{{ form.description }}</div>
{{/?}}
  <div class="{{ form.status }}">{{ form.status_message }}</div>
  {{!for form.fields  as='field'  do=@:field }}
  {{!for form.buttons as='button' do=@:button }}
</form>

{{:field field.type == 'fieldset'}}
<fieldset id="{{ field.name }}" name="{{ field.name }}">
  <legend>{{ field.title }}</legend>
  {{? field.description }} <p>{{ field.description }}</p> {{/?}}
  {{!for field.fields as='field' do=@:field }}
  <div class="{{ field.status }}">{{ field.status_message }}</div>
</fieldset>
{{/:field}}

{{:field field.type == 'text'}}
<div class="field-">
  <label for="{{ field.name }}">{{ field.title }}</label>
  <input type="text" id="{{ field.name }}" name="{{ field.name }}" value="{{ field.value }}"{{? field.readonly}} readonly="readonly" {{/?}} class="text-" />
  {{? field.default}}
    <!--div>
    <input type="checkbox" id="_{{ field.name }}_default" name="_{{ field.name }}_default"/>
    </div-->
  {{/?}}
  <div class="desc-">{{ field.description }}</div>
  <div class="{{ field.status }}">{{ field.status_message }}</div>
</div>
{{/:field}}

{{:field field.type == 'Boolean'}}
<div class="field-">
	<input type="checkbox" id="{{ field.name }}" name="{{ field.name }}" value="{{ field.value }}"{{? 'true' == field.value }} checked="checked"{{/?}}{{? field.readonly}} readonly="readonly" {{/?}} />
  <label for="{{ field.name }}">{{ field.title }}</label>
  <div class="desc-">{{ field.description }}</div>
  <div class="{{ field.status }}">{{ field.status_message }}</div>
</div>
{{/:field}}

{{:field field.type == 'passwordEdit' && field.event == 'create'}}
<div class="field-">
  <label for="{{ field.name }}">{{ field.title }}</label>
  <input type="password" id="{{ field.name }}" name="{{ field.name }}" value="" class="text-" />
  <input type="password" id="_{{ field.name }}_2" name="_{{ field.name }}_2" value="" class="text-" />
  {{?field.description}}<div class="desc-">{{ field.description }}</div>{{/?}}
  {{?field.status}}<div class="{{ field.status }}">{{ field.status_message }}</div>{{/?}}
</div>
{{/:field}}

{{:field field.type == 'passwordEdit' && field.event == 'update'}}
<fieldset id="_{{ field.name }}" name="_{{ field.name }}">
  <legend>{{ field.title }}</legend>
  <label for="_{{ field.name }}_old">старый пароль</label>
  <input type="password" id="_{{ field.name }}_old" name="_{{ field.name }}_old" value="{{ field.old_value_check }}" class="text-" />
  <label for="{{ field.name }}">новый пароль</label>
  <input type="password" id="{{ field.name }}" name="{{ field.name }}" value="" class="text-" />
  <label for="_{{ field.name }}_2">{{ field.title }}новый пароль еще раз</label>
  <input type="password" id="_{{ field.name }}_2" name="_{{ field.name }}_2" value="" class="text-" />
  {{?field.description}}<div class="desc-">{{ field.description }}</div>{{/?}}
  {{?field.status}}<div class="{{ field.status }}">{{ field.status_message }}</div>{{/?}}
</fieldset>
{{/:field}}

{{:field field.type == 'password'}}
<div class="field-">
  <label for="{{ field.name }}">{{ field.title }}</label>
  <input type="password" id="{{ field.name }}" name="{{ field.name }}" value="" class="text-" />
  {{?field.description}}<div class="desc-">{{ field.description }}</div>{{/?}}
  {{?field.status}}<div class="{{ field.status }}">{{ field.status_message }}</div>{{/?}}
</div>
{{/:field}}

{{:field field.type == 'hidden'}}
<input type="hidden" id="{{ field.name }}" name="{{ field.name }}" value="{{ field.value }}" />
{{/:field}}


{{:button button.type == 'image'}}
<input type="image" name="_{{ button.name }}" src="{{ button.src }}" alt="{{ button.title }}" />
{{/:button}}
